package cn.powertime.evaluation.service.impl;

import cn.powertime.evaluation.Constants;
import cn.powertime.evaluation.entity.CpsExaminationPaper;
import cn.powertime.evaluation.mapper.CpsExaminationPaperMapper;
import cn.powertime.evaluation.service.CpsExaminationPaperService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 试卷试题表 服务实现类
 * </p>
 *
 * @author liqi
 * @since 2019-09-23
 */
@Service
public class CpsExaminationPaperServiceImpl extends ServiceImpl<CpsExaminationPaperMapper, CpsExaminationPaper> implements CpsExaminationPaperService {

    @Autowired
    private CpsExaminationPaperMapper examinationPaperMapper;

    @Override
    public CpsExaminationPaper selectExaminationPaper(Long testPaperId, Long topicId) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("test_paper_id", testPaperId);
        queryWrapper.eq("topic_id", topicId);
        queryWrapper.eq("status", Constants.STATUS_NORMAL);
        return this.examinationPaperMapper.selectOne(queryWrapper);
    }
    
}
